package com.frxuexi.park2209.notice

import androidx.lifecycle.MutableLiveData
import com.frxuexi.base.mvvm.BaseViewModel
import com.frxuexi.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import javax.inject.Inject

@HiltViewModel
class NoticeViewModel @Inject constructor(val apiService: ApiService):BaseViewModel() {

//    var noticeSuc = MutableStateFlow<String>("")

    var noticeSuc =MutableLiveData<String>()

    var addNoticeSuc = MutableStateFlow<String>("")

    fun getNotices(map: Map<String,Int>){
        httpRequest({apiService.getNotices(mapToBody(map))},{noticeSuc.value=it})
    }

    fun addNotice(map: Map<String, String>){
        httpRequest({apiService.addNotice(mapToBody(map))},{addNoticeSuc.value=it})
    }
}